const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需要加1
const day = String(today.getDate()).padStart(2, '0');
const formattedDate = `${year}年${month}月${day}日`;
// 输出格式为 YYYY年MM月DD日

const option = {
    title: {
        text: '设备使用者的年龄分布',
        textStyle: {
            color: '#028370' // 字体颜色
        },
        subtext: formattedDate,
    },
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine'],
        left:'30%'
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    /*
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },

     */
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ["0~22岁", "23~30岁", "31~45岁", "46~60岁", "61岁及以上"]
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            //name: 'Email',
            type: 'line',
            stack: 'Total',
            data: [120, 132, 101, 134, 90, 230, 210]
        }
    ]

}

/*
const option = {
  title: {
      text: '设备使用者的年龄分布',
      textStyle: {
          color: '#028370' // 字体颜色
      },
      subtext: formattedDate,
      // top: 10,
      // left: 10
  },
  tooltip: {
      trigger: 'item',
      extraCssText: 'z-index: 999'
  },
  // legend: {
  //     type: 'scroll',
  //     bottom: 0,
  //     data: (function (){
  //         var list = [];
  //         for (var i = 1; i <=28; i++) {
  //             list.push(i + 2000 + '');
  //         }
  //         return list;
  //     })()
  // },
  visualMap: {
      top: 'middle',
      right: 10,
      color: ['red', 'yellow'],
      calculable: true
  },
  radar: {
      center: ['50%', '60%'],
      indicator: [
          { text: '0~22岁', max: 400},
          { text: '23~30岁', max: 400},
          { text: '31~45岁', max: 400},
          { text: '46~60岁', max: 400},
          { text: '61岁及以上', max: 400}
      ]
  },
  series: (function (){
      var series = [];
      for (var i = 1; i <= 28; i++) {
          series.push({
              name: '浏览器（数据纯属虚构）',
              type: 'radar',
              symbol: 'none',
              lineStyle: {
                  width: 1
              },
              emphasis: {
                  areaStyle: {
                      color: 'rgba(0,250,0,0.3)'
                  }
              },
              data: [{
                  value: [
                      (40 - i) * 10,
                      (38 - i) * 4 + 60,
                      i * 5 + 10,
                      i * 9,
                      i * i /2
                  ],
                  name: i + 2000 + ''
              }]
          });
      }
      return series;
  })()
};

 */

export default option